<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

    <script>
        // ES5 => ES6
        Plane.prototype.fly = function () {
            console.log('fly');
        };

        function Plane (name) {
            this.name = name || '普通飞机';
            this.blood = 100;
            // this.fly = function () {
            //     console.log('fly');
            // }
        };



        // 继承  继承原型  私有属性


        // AttackPlane.prototype = new Plane();

        // var temp = function () {};
        // temp.prototype = Plane.prototype;
        // AttackPlane.prototype = new temp();

        // 
        // AttackPlane.prototype.__proto__ = Plane.prototype;
        // AttackPlane.prototype = Object.create(Plane.prototype, {
        //     constructor: AttackPlane
        // });

        // Object.setPrototypeOf();

        Object.setPrototypeOf(AttackPlane.prototype, Plane.prototype);

        AttackPlane.prototype.dan = function () {
            console.log('biubiubiu');
        };

        function AttackPlane (name) {
            // this.name = '攻击机';
            // this.blood = 100;
            // 借用构造函数的方式
            Plane.call(this, name);
        };
        
        var oAP = new AttackPlane('攻击机');
    
        var oPlane = new Plane();



        // Class







    </script>
</body>
</html>